]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
magnifier: Keep accounting of own cursor unfocus inhibition
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 23 Nov 2023 23:28:39 +0000 (00:28 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 13 Feb 2024 11:49:28 +0000 (11:49 +0000)
Do not rely on global state since there may be more users of it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3028>

js/ui/magnifier.js

index 60971e9142870ac1ad01ea91717c2b475f4e5f15..84a2d8924ffbb7f344fcc87cc3d0bab80f71d417 100644 (file)
@@ -126,6 +126,7 @@ export class Magnifier extends Signals.EventEmitter {
         });
 
         this.setActive(St.Settings.get().magnifier_active);
+        this._cursorUnfocusInhibited = false;
     }
 
     /**
@@ -135,8 +136,10 @@ export class Magnifier extends Signals.EventEmitter {
     showSystemCursor() {
         const seat = Clutter.get_default_backend().get_default_seat();
 
-        if (seat.is_unfocus_inhibited())
+        if (this._cursorUnfocusInhibited) {
             seat.uninhibit_unfocus();
+            this._cursorUnfocusInhibited = false;
+        }
 
         if (this._cursorVisibilityChangedId) {
             this._cursorTracker.disconnect(this._cursorVisibilityChangedId);
@@ -153,8 +156,10 @@ export class Magnifier extends Signals.EventEmitter {
     hideSystemCursor() {
         const seat = Clutter.get_default_backend().get_default_seat();
 
-        if (!seat.is_unfocus_inhibited())
+        if (!this._cursorUnfocusInhibited) {
             seat.inhibit_unfocus();
+            this._cursorUnfocusInhibited = true;
+        }
 
         if (!this._cursorVisibilityChangedId) {
             this._cursorTracker.set_pointer_visible(false);